import request from './request'

// 创建会话
export const createSession = (agent_id, title) => {
  return request.post('/sessions', { agent_id, title })
}

// 获取会话列表
export const getSessions = () => {
  return request.get('/sessions')
}

// 获取会话详情
export const getSessionDetail = (sessionId) => {
  return request.get(`/sessions/${sessionId}`)
}

// 更新会话
export const updateSession = (sessionId, data) => {
  return request.patch(`/sessions/${sessionId}`, data)
}

// 删除会话
export const deleteSession = (sessionId) => {
  return request.delete(`/sessions/${sessionId}`)
}

// 获取会话消息列表
export const getMessages = (sessionId, page = 1, page_size = 10) => {
  return request.get(`/sessions/${sessionId}/messages`, {
    params: { page, page_size }
  })
}

// 发送消息
export const sendMessage = (sessionId, content) => {
  return request.post(`/sessions/${sessionId}/messages`, { content })
}

